3.295 \(\int (g+h x)^2 (A+B \log (e (a+b x)^n (c+d x)^{-n})) \, dx\)

Optimal. Leaf size=158 \[ \frac{(g+h x)^3 \left (B \log \left (e (a+b x)^n (c+d x)^{-n}\right )+A\right )}{3 h}-\frac{B h n x (b c-a d) (-a d h-b c h+3 b d g)}{3 b^2 d^2}-\frac{B n (b g-a h)^3 \log (a+b x)}{3 b^3 h}-\frac{B h^2 n x^2 (b c-a d)}{6 b d}+\frac{B n (d g-c h)^3 \log (c+d x)}{3 d^3 h} \]

[Out]

-(B*(b*c - a*d)*h*(3*b*d*g - b*c*h - a*d*h)*n*x)/(3*b^2*d^2) - (B*(b*c - a*d)*h^2*n*x^2)/(6*b*d) - (B*(b*g - a
*h)^3*n*Log[a + b*x])/(3*b^3*h) + (B*(d*g - c*h)^3*n*Log[c + d*x])/(3*d^3*h) + ((g + h*x)^3*(A + B*Log[(e*(a +
 b*x)^n)/(c + d*x)^n]))/(3*h)

________________________________________________________________________________________

Rubi [A]  time = 0.240267, antiderivative size = 170, normalized size of antiderivative = 1.08, number of steps used = 5, number of rules used = 3, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.097, Rules used = {6742, 2492, 72} \[ -\frac{B h n x (b c-a d) (-a d h-b c h+3 b d g)}{3 b^2 d^2}-\frac{B n (b g-a h)^3 \log (a+b x)}{3 b^3 h}+\frac{B (g+h x)^3 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{3 h}-\frac{B h^2 n x^2 (b c-a d)}{6 b d}+\frac{A (g+h x)^3}{3 h}+\frac{B n (d g-c h)^3 \log (c+d x)}{3 d^3 h} \]

Antiderivative was successfully verified.

[In]

Int[(g + h*x)^2*(A + B*Log[(e*(a + b*x)^n)/(c + d*x)^n]),x]

[Out]

-(B*(b*c - a*d)*h*(3*b*d*g - b*c*h - a*d*h)*n*x)/(3*b^2*d^2) - (B*(b*c - a*d)*h^2*n*x^2)/(6*b*d) + (A*(g + h*x
)^3)/(3*h) - (B*(b*g - a*h)^3*n*Log[a + b*x])/(3*b^3*h) + (B*(d*g - c*h)^3*n*Log[c + d*x])/(3*d^3*h) + (B*(g +
 h*x)^3*Log[(e*(a + b*x)^n)/(c + d*x)^n])/(3*h)

Rule 6742

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rule 2492

Int[Log[(e_.)*((f_.)*((a_.) + (b_.)*(x_))^(p_.)*((c_.) + (d_.)*(x_))^(q_.))^(r_.)]^(s_.)*((g_.) + (h_.)*(x_))^
(m_.), x_Symbol] :> Simp[((g + h*x)^(m + 1)*Log[e*(f*(a + b*x)^p*(c + d*x)^q)^r]^s)/(h*(m + 1)), x] - Dist[(p*
r*s*(b*c - a*d))/(h*(m + 1)), Int[((g + h*x)^(m + 1)*Log[e*(f*(a + b*x)^p*(c + d*x)^q)^r]^(s - 1))/((a + b*x)*
(c + d*x)), x], x] /; FreeQ[{a, b, c, d, e, f, g, h, m, p, q, r, s}, x] && NeQ[b*c - a*d, 0] && EqQ[p + q, 0]
&& IGtQ[s, 0] && NeQ[m, -1]

Rule 72

Int[((e_.) + (f_.)*(x_))^(p_.)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Int[ExpandIntegrand[(
e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[p]

Rubi steps

\begin{align*} \int (g+h x)^2 \left (A+B \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right ) \, dx &=\int \left (A (g+h x)^2+B (g+h x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right ) \, dx\\ &=\frac{A (g+h x)^3}{3 h}+B \int (g+h x)^2 \log \left (e (a+b x)^n (c+d x)^{-n}\right ) \, dx\\ &=\frac{A (g+h x)^3}{3 h}+\frac{B (g+h x)^3 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{3 h}-\frac{(B (b c-a d) n) \int \frac{(g+h x)^3}{(a+b x) (c+d x)} \, dx}{3 h}\\ &=\frac{A (g+h x)^3}{3 h}+\frac{B (g+h x)^3 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{3 h}-\frac{(B (b c-a d) n) \int \left (\frac{h^2 (3 b d g-b c h-a d h)}{b^2 d^2}+\frac{h^3 x}{b d}+\frac{(b g-a h)^3}{b^2 (b c-a d) (a+b x)}+\frac{(d g-c h)^3}{d^2 (-b c+a d) (c+d x)}\right ) \, dx}{3 h}\\ &=-\frac{B (b c-a d) h (3 b d g-b c h-a d h) n x}{3 b^2 d^2}-\frac{B (b c-a d) h^2 n x^2}{6 b d}+\frac{A (g+h x)^3}{3 h}-\frac{B (b g-a h)^3 n \log (a+b x)}{3 b^3 h}+\frac{B (d g-c h)^3 n \log (c+d x)}{3 d^3 h}+\frac{B (g+h x)^3 \log \left (e (a+b x)^n (c+d x)^{-n}\right )}{3 h}\\ \end{align*}

Mathematica [A]  time = 0.337093, size = 204, normalized size = 1.29 \[ \frac{2 a^2 B d^3 h n (a h-3 b g) \log (a+b x)+b \left (d x \left (B h n (b c-a d) (2 a d h+2 b c h-6 b d g-b d h x)+2 A b^2 d^2 \left (3 g^2+3 g h x+h^2 x^2\right )\right )-2 b B n \log (c+d x) \left (b c \left (c^2 h^2-3 c d g h+3 d^2 g^2\right )-3 a d^3 g^2\right )+2 b B d^3 \left (3 a g^2+b x \left (3 g^2+3 g h x+h^2 x^2\right )\right ) \log \left (e (a+b x)^n (c+d x)^{-n}\right )\right )}{6 b^3 d^3} \]

Antiderivative was successfully verified.

[In]

Integrate[(g + h*x)^2*(A + B*Log[(e*(a + b*x)^n)/(c + d*x)^n]),x]

[Out]

(2*a^2*B*d^3*h*(-3*b*g + a*h)*n*Log[a + b*x] + b*(d*x*(B*(b*c - a*d)*h*n*(-6*b*d*g + 2*b*c*h + 2*a*d*h - b*d*h
*x) + 2*A*b^2*d^2*(3*g^2 + 3*g*h*x + h^2*x^2)) - 2*b*B*(-3*a*d^3*g^2 + b*c*(3*d^2*g^2 - 3*c*d*g*h + c^2*h^2))*
n*Log[c + d*x] + 2*b*B*d^3*(3*a*g^2 + b*x*(3*g^2 + 3*g*h*x + h^2*x^2))*Log[(e*(a + b*x)^n)/(c + d*x)^n]))/(6*b
^3*d^3)

________________________________________________________________________________________

Maple [C]  time = 0.576, size = 1389, normalized size = 8.8 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((h*x+g)^2*(A+B*ln(e*(b*x+a)^n/((d*x+c)^n))),x)

[Out]

B*g^2*x*ln((b*x+a)^n)-1/3*(h*x+g)^3*B/h*ln((d*x+c)^n)+1/3*h^2*B*ln(e)*x^3+1/3*h^2*B*x^3*ln((b*x+a)^n)+B*ln(e)*
g^2*x+h*B*ln(e)*g*x^2+h*B*g*x^2*ln((b*x+a)^n)+1/3/h*B*ln(d*x+c)*g^3*n+1/3*h^2*A*x^3-1/2*I*h*B*Pi*g*x^2*csgn(I*
e)*csgn(I*(b*x+a)^n/((d*x+c)^n))*csgn(I*e/((d*x+c)^n)*(b*x+a)^n)-1/2*I*h*B*Pi*g*x^2*csgn(I*(b*x+a)^n)*csgn(I/(
(d*x+c)^n))*csgn(I*(b*x+a)^n/((d*x+c)^n))+h*A*g*x^2+A*g^2*x+1/3*h^2/b^3*B*ln(-b*x-a)*a^3*n-1/3/d^3*h^2*B*ln(d*
x+c)*c^3*n+1/b*B*ln(-b*x-a)*a*g^2*n-1/d*B*ln(d*x+c)*c*g^2*n-1/2*I*B*Pi*g^2*x*csgn(I*e/((d*x+c)^n)*(b*x+a)^n)^3
-1/2*I*B*Pi*g^2*x*csgn(I*(b*x+a)^n/((d*x+c)^n))^3-1/6*I*h^2*B*Pi*x^3*csgn(I*e/((d*x+c)^n)*(b*x+a)^n)^3-1/6*I*h
^2*B*Pi*x^3*csgn(I*(b*x+a)^n/((d*x+c)^n))^3+1/6*h^2/b*B*a*n*x^2-1/6/d*h^2*B*c*n*x^2-1/3*h^2/b^2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)^n)*(b*x+a)^n)^2+1/2*I*h*B*Pi*g*x^2*csgn(I*(b*x+a)^n
)*csgn(I*(b*x+a)^n/((d*x+c)^n))^2+1/2*I*h*B*Pi*g*x^2*csgn(I/((d*x+c)^n))*csgn(I*(b*x+a)^n/((d*x+c)^n))^2-1/2*I
*B*Pi*g^2*x*csgn(I*e)*csgn(I*(b*x+a)^n/((d*x+c)^n))*csgn(I*e/((d*x+c)^n)*(b*x+a)^n)-1/2*I*B*Pi*g^2*x*csgn(I*(b
*x+a)^n)*csgn(I/((d*x+c)^n))*csgn(I*(b*x+a)^n/((d*x+c)^n))+h/b*B*a*g*n*x-1/d*h*B*c*g*n*x

________________________________________________________________________________________

Maxima [A]  time = 1.19188, size = 397, normalized size = 2.51 \begin{align*} \frac{1}{3} \, B h^{2} x^{3} \log \left (\frac{{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + \frac{1}{3} \, A h^{2} x^{3} + B g h x^{2} \log \left (\frac{{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A g h x^{2} + B g^{2} x \log \left (\frac{{\left (b x + a\right )}^{n} e}{{\left (d x + c\right )}^{n}}\right ) + A g^{2} x + \frac{{\left (\frac{a e n \log \left (b x + a\right )}{b} - \frac{c e n \log \left (d x + c\right )}{d}\right )} B g^{2}}{e} - \frac{{\left (\frac{a^{2} e n \log \left (b x + a\right )}{b^{2}} - \frac{c^{2} e n \log \left (d x + c\right )}{d^{2}} + \frac{{\left (b c e n - a d e n\right )} x}{b d}\right )} B g h}{e} + \frac{{\left (\frac{2 \, a^{3} e n \log \left (b x + a\right )}{b^{3}} - \frac{2 \, c^{3} e n \log \left (d x + c\right )}{d^{3}} - \frac{{\left (b^{2} c d e n - a b d^{2} e n\right )} x^{2} - 2 \,{\left (b^{2} c^{2} e n - a^{2} d^{2} e n\right )} x}{b^{2} d^{2}}\right )} B h^{2}}{6 \, e} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)^2*(A+B*log(e*(b*x+a)^n/((d*x+c)^n))),x, algorithm="maxima")

[Out]

1/3*B*h^2*x^3*log((b*x + a)^n*e/(d*x + c)^n) + 1/3*A*h^2*x^3 + B*g*h*x^2*log((b*x + a)^n*e/(d*x + c)^n) + A*g*
h*x^2 + B*g^2*x*log((b*x + a)^n*e/(d*x + c)^n) + A*g^2*x + (a*e*n*log(b*x + a)/b - c*e*n*log(d*x + c)/d)*B*g^2
/e - (a^2*e*n*log(b*x + a)/b^2 - c^2*e*n*log(d*x + c)/d^2 + (b*c*e*n - a*d*e*n)*x/(b*d))*B*g*h/e + 1/6*(2*a^3*
e*n*log(b*x + a)/b^3 - 2*c^3*e*n*log(d*x + c)/d^3 - ((b^2*c*d*e*n - a*b*d^2*e*n)*x^2 - 2*(b^2*c^2*e*n - a^2*d^
2*e*n)*x)/(b^2*d^2))*B*h^2/e

________________________________________________________________________________________

Fricas [B]  time = 1.08998, size = 753, normalized size = 4.77 \begin{align*} \frac{2 \, A b^{3} d^{3} h^{2} x^{3} +{\left (6 \, A b^{3} d^{3} g h -{\left (B b^{3} c d^{2} - B a b^{2} d^{3}\right )} h^{2} n\right )} x^{2} + 2 \,{\left (3 \, A b^{3} d^{3} g^{2} -{\left (3 \,{\left (B b^{3} c d^{2} - B a b^{2} d^{3}\right )} g h -{\left (B b^{3} c^{2} d - B a^{2} b d^{3}\right )} h^{2}\right )} n\right )} x + 2 \,{\left (B b^{3} d^{3} h^{2} n x^{3} + 3 \, B b^{3} d^{3} g h n x^{2} + 3 \, B b^{3} d^{3} g^{2} n x +{\left (3 \, B a b^{2} d^{3} g^{2} - 3 \, B a^{2} b d^{3} g h + B a^{3} d^{3} h^{2}\right )} n\right )} \log \left (b x + a\right ) - 2 \,{\left (B b^{3} d^{3} h^{2} n x^{3} + 3 \, B b^{3} d^{3} g h n x^{2} + 3 \, B b^{3} d^{3} g^{2} n x +{\left (3 \, B b^{3} c d^{2} g^{2} - 3 \, B b^{3} c^{2} d g h + B b^{3} c^{3} h^{2}\right )} n\right )} \log \left (d x + c\right ) + 2 \,{\left (B b^{3} d^{3} h^{2} x^{3} + 3 \, B b^{3} d^{3} g h x^{2} + 3 \, B b^{3} d^{3} g^{2} x\right )} \log \left (e\right )}{6 \, b^{3} d^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)^2*(A+B*log(e*(b*x+a)^n/((d*x+c)^n))),x, algorithm="fricas")

[Out]

1/6*(2*A*b^3*d^3*h^2*x^3 + (6*A*b^3*d^3*g*h - (B*b^3*c*d^2 - B*a*b^2*d^3)*h^2*n)*x^2 + 2*(3*A*b^3*d^3*g^2 - (3
*(B*b^3*c*d^2 - B*a*b^2*d^3)*g*h - (B*b^3*c^2*d - B*a^2*b*d^3)*h^2)*n)*x + 2*(B*b^3*d^3*h^2*n*x^3 + 3*B*b^3*d^
3*g*h*n*x^2 + 3*B*b^3*d^3*g^2*n*x + (3*B*a*b^2*d^3*g^2 - 3*B*a^2*b*d^3*g*h + B*a^3*d^3*h^2)*n)*log(b*x + a) -
2*(B*b^3*d^3*h^2*n*x^3 + 3*B*b^3*d^3*g*h*n*x^2 + 3*B*b^3*d^3*g^2*n*x + (3*B*b^3*c*d^2*g^2 - 3*B*b^3*c^2*d*g*h
+ B*b^3*c^3*h^2)*n)*log(d*x + c) + 2*(B*b^3*d^3*h^2*x^3 + 3*B*b^3*d^3*g*h*x^2 + 3*B*b^3*d^3*g^2*x)*log(e))/(b^
3*d^3)

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)**2*(A+B*ln(e*(b*x+a)**n/((d*x+c)**n))),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 77.4189, size = 402, normalized size = 2.54 \begin{align*} \frac{1}{3} \,{\left (A h^{2} + B h^{2}\right )} x^{3} + \frac{1}{3} \,{\left (B h^{2} n x^{3} + 3 \, B g h n x^{2} + 3 \, B g^{2} n x\right )} \log \left (b x + a\right ) - \frac{1}{3} \,{\left (B h^{2} n x^{3} + 3 \, B g h n x^{2} + 3 \, B g^{2} n x\right )} \log \left (d x + c\right ) - \frac{{\left (B b c h^{2} n - B a d h^{2} n - 6 \, A b d g h - 6 \, B b d g h\right )} x^{2}}{6 \, b d} + \frac{{\left (3 \, B a b^{2} g^{2} n - 3 \, B a^{2} b g h n + B a^{3} h^{2} n\right )} \log \left (b x + a\right )}{3 \, b^{3}} - \frac{{\left (3 \, B c d^{2} g^{2} n - 3 \, B c^{2} d g h n + B c^{3} h^{2} n\right )} \log \left (-d x - c\right )}{3 \, d^{3}} - \frac{{\left (3 \, B b^{2} c d g h n - 3 \, B a b d^{2} g h n - B b^{2} c^{2} h^{2} n + B a^{2} d^{2} h^{2} n - 3 \, A b^{2} d^{2} g^{2} - 3 \, B b^{2} d^{2} g^{2}\right )} x}{3 \, b^{2} d^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x+g)^2*(A+B*log(e*(b*x+a)^n/((d*x+c)^n))),x, algorithm="giac")

[Out]

1/3*(A*h^2 + B*h^2)*x^3 + 1/3*(B*h^2*n*x^3 + 3*B*g*h*n*x^2 + 3*B*g^2*n*x)*log(b*x + a) - 1/3*(B*h^2*n*x^3 + 3*
B*g*h*n*x^2 + 3*B*g^2*n*x)*log(d*x + c) - 1/6*(B*b*c*h^2*n - B*a*d*h^2*n - 6*A*b*d*g*h - 6*B*b*d*g*h)*x^2/(b*d
) + 1/3*(3*B*a*b^2*g^2*n - 3*B*a^2*b*g*h*n + B*a^3*h^2*n)*log(b*x + a)/b^3 - 1/3*(3*B*c*d^2*g^2*n - 3*B*c^2*d*
g*h*n + B*c^3*h^2*n)*log(-d*x - c)/d^3 - 1/3*(3*B*b^2*c*d*g*h*n - 3*B*a*b*d^2*g*h*n - B*b^2*c^2*h^2*n + B*a^2*
d^2*h^2*n - 3*A*b^2*d^2*g^2 - 3*B*b^2*d^2*g^2)*x/(b^2*d^2)